import 'package:get/get.dart';
import 'app_routes.dart';
import '../modules/splash/bindings/splash_binding.dart';
import '../modules/splash/views/splash_view.dart';
import '../modules/auth/bindings/auth_binding.dart';
import '../modules/auth/views/login_view.dart';
import '../modules/auth/views/register_view.dart';
import '../modules/auth/views/recovery_view.dart';
import '../modules/home/bindings/home_binding.dart';
import '../modules/home/views/home_view.dart';
import '../modules/profile/bindings/profile_binding.dart';
import '../modules/profile/views/profile_view.dart';
import '../modules/profile/views/edit_profile_view.dart';
import '../modules/device/bindings/device_binding.dart';
import '../modules/device/views/device_detail_view.dart';
import '../modules/device/views/add_device_view.dart';
import '../modules/device/bindings/add_device_binding.dart';
import '../modules/device/views/device_list_view.dart';
import '../modules/device/bindings/device_list_binding.dart';
import '../pages/settings/settings_view.dart';
import '../pages/about/about_view.dart';
import '../pages/unauthorized/unauthorized_view.dart';
import '../modules/admin/views/admin_dashboard_view.dart';
import '../modules/admin/bindings/admin_binding.dart';
import '../pages/error/error_view.dart';
import '../modules/devices/bindings/device_list_binding.dart';
import '../modules/devices/views/pages/device_list_page.dart';

/// 应用路由页面配置
class AppPages {
  /// 私有构造函数
  AppPages._();
  
  /// 初始路由
  static const initial = AppRoutes.splash;
  
  /// 路由页面配置
  static final routes = [
    // 启动屏
    GetPage(
      name: AppRoutes.splash,
      page: () => const SplashView(),
      binding: SplashBinding(),
      transition: Transition.fade,
      transitionDuration: const Duration(milliseconds: 500),
    ),
    
    // 认证模块 - 登录
    GetPage(
      name: AppRoutes.login,
      page: () => const LoginView(),
      binding: AuthBinding(),
      transition: Transition.fadeIn,
    ),
    
    // 认证模块 - 注册
    GetPage(
      name: AppRoutes.register,
      page: () => const RegisterView(),
      binding: AuthBinding(),
      transition: Transition.fadeIn,
    ),
    
    // 认证模块 - 忘记密码
    GetPage(
      name: AppRoutes.forgotPassword,
      page: () => const RecoveryView(isReset: false),
      binding: AuthBinding(),
      transition: Transition.fadeIn,
    ),
    
    // 认证模块 - 重置密码
    GetPage(
      name: AppRoutes.resetPassword,
      page: () => const RecoveryView(isReset: true),
      binding: AuthBinding(),
      transition: Transition.fadeIn,
    ),
    
    // 首页模块
    GetPage(
      name: AppRoutes.home,
      page: () => const HomeView(),
      binding: HomeBinding(),
      transition: Transition.fadeIn,
      children: [
        // 设备详情页
        GetPage(
          name: '/device-detail/:id',
          page: () => const HomeDetailView(),
          transition: Transition.rightToLeft,
        ),
      ],
    ),
    
    // 个人资料模块
    GetPage(
      name: AppRoutes.profile,
      page: () => const ProfileView(),
      binding: ProfileBinding(),
      transition: Transition.fadeIn,
    ),
    
    // 编辑个人资料页
    GetPage(
      name: AppRoutes.editProfile,
      page: () => const EditProfileView(),
      binding: ProfileBinding(),
      transition: Transition.rightToLeft,
    ),
    
    // 设置页
    GetPage(
      name: AppRoutes.settings,
      page: () => const SettingsView(),
      transition: Transition.rightToLeft,
    ),
    
    // 关于页
    GetPage(
      name: AppRoutes.about,
      page: () => const AboutView(),
      transition: Transition.rightToLeft,
    ),
    
    // 设备列表页
    GetPage(
      name: AppRoutes.DEVICE_LIST,
      page: () => const DeviceListPage(),
      binding: DeviceListBinding(),
      transition: Transition.leftToRightWithFade,
    ),
    
    // 设备详情页 (后面实现)
    // GetPage(
    //   name: AppRoutes.DEVICE_DETAIL + '/:deviceId', // 使用参数
    //   page: () => const DeviceDetailPage(),
    //   binding: DeviceDetailBinding(),
    // ),
    
    // 添加设备页 (后面实现)
    // GetPage(
    //   name: AppRoutes.DEVICE_ADD,
    //   page: () => const DeviceAddPage(),
    //   binding: DeviceAddBinding(),
    //   fullscreenDialog: true,
    // ),
    
    // 管理员控制台
    GetPage(
      name: AppRoutes.adminDashboard,
      page: () => const AdminDashboardView(),
      binding: AdminBinding(),
      transition: Transition.fadeIn,
    ),
    
    // 未授权页
    GetPage(
      name: AppRoutes.unauthorized,
      page: () => const UnauthorizedView(),
      transition: Transition.fadeIn,
    ),
    
    // 错误页面
    GetPage(
      name: AppRoutes.error,
      page: () => const ErrorView(),
      transition: Transition.fadeIn,
    ),
  ];
} 